home *** CD-ROM | disk | FTP | other *** search
/ Software Vault: The Diamond Collection / The Diamond Collection (Software Vault)(Digital Impact).ISO / cdr40 / aprs67.zip / MAPFIX67.BAS < prev    next >
BASIC Source File  |  1995-03-20  |  67KB  |  1,547 lines

  1. REM MAPFIX.bas PROGRAM.  SEE EXPLAINATIONs BELOW
  2. REM
  3. Ver$ = "6.7": ' ADDED MOUSE!
  4.  
  5. MaxNumMAPS = 150'was 99 Current maximum number of maps loaded by APRS
  6. MaxNumPoints = 3000 'was 1000
  7. MaxNumLABELS = 99 'was 99
  8. MaxNumLines = 1900
  9. REM $DYNAMIC
  10.    ScrnType$ = "EGA": Ycen = 175: Yfactr = 1: YfacTXT = 350 / 350: SCREEN 9
  11.    COLOR 15, 0
  12.    REM ScrnType$ = "CGA": Yfactr=200/400:Ycen = 200*Yfactr: SCREEN 2
  13.    REM INPUT "High resolution text on maps (y/N)"; a$
  14.    a$ = "Y": Cfactr = 14: BLn = 25
  15.    IF UCASE$(a$) = "Y" THEN GBLn = 43: Cfactr = 8: BLn = 43
  16.    WIDTH 80, 43
  17.  
  18.    PALETTE 6, 6
  19.    DIM Crsr(16)
  20.    CIRCLE (4, 3), 4, 14
  21.    GET (0, 0)-(8, 6), Crsr
  22.    REM PSET (40, 50), 10
  23.    REM PUT (40 - 4, 50 - 3), Crsr, XOR
  24.    REM LOCATE 23, 1: INPUT a$
  25. GOTO BEGIN
  26.  
  27. Info: COLOR 14, 8: CLS
  28.    PRINT "Ver 6.7  No new features.  Tried to reduce program size to avoid memory probs."
  29.    PRINT "         Fixed the re-draw of lines during ADDs."
  30.    PRINT
  31.    PRINT "Ver 6.6  Fixed a bug which prevented the FIRST road in the file from being"
  32.    PRINT "         shown.  IT was there, and everything worked, but it was displayed"
  33.    PRINT "         in black...   This version was posted later and added to APRS6.6"
  34.    PRINT
  35.    PRINT "Ver 6.5d This version ADDED MOUSE SUPPORT!  And was initially distro'd with"
  36.    PRINT "         the first few days of 6.6.  See above"
  37.    PRINT
  38.    PRINT "MOUSE MODES:"
  39.    PRINT
  40.    PRINT
  41.    PRINT " CURSOR: Use F9 to open appropriate MOUSE port (must be MICROSOFT SERIAL"
  42.    PRINT "         MOUSE).  Left button is ALT-ADD and right button is FIND command."
  43.    PRINT
  44.    PRINT " POOR-MANS-MOUSE DIGITIZER:  Use alt-O to OPEN COMM port and READ MOUSE.txt"
  45.  
  46.    LOCATE BLn, 1: PRINT " HIT ANY KEY to continue...";
  47.    GOSUB GetChar: SOUND 800, 3
  48.    CLS
  49.  
  50.  
  51.    PRINT
  52.    PRINT " MAPFIX.bas VERSION "; Ver$; " PROGRAM FOR FIXING APRS MAPS": PRINT
  53.    PRINT " NEW FEATURES HIGHLIGHTED BELOW!.  Check the version number and HELP screen!"
  54.    COLOR 15, 8
  55.    PRINT
  56.    PRINT " MAPFIX can build and edit APRS maps in a variety of ways:"
  57.    PRINT
  58.    PRINT " FREE-HAND: Good for filling in missing roads, but hard to make roads exact"
  59.    PRINT " CDROM:     Gets points from 2,000,000:1 and 100,000:1 USGS CD ROM. "
  60.    PRINT "            Both generate Mbytes worth of points that take a lot of time to"
  61.    PRINT "            filter down to a useable APRS size!"
  62.    PRINT " TABLET:    Connect a serial data digitizer tablet and draw!     BEST METHOD!"
  63.    PRINT " GPS DATA:  Replay any APRS GPS track history file and DRAW map lines over it"
  64.    PRINT " CONVERSION:Change origin or scale on-line (old function of MAPCNVRT.bas)"
  65.    PRINT " IMPORTING: Import features from other maps with auto-point conversion!"
  66.    PRINT
  67.    PRINT " Although MAPFIX is very versitile, manipulating points with a TEXT EDITOR is"
  68.    PRINT " still useful for whole scale rearranging of points and features in a map file. "
  69.    PRINT
  70.    PRINT " MAPFIX uses the normal yellow APRS cursor, and a White MapPoint which marks the"
  71.    PRINT " next point to be processed.  ALT Keys allow you to MOVE the MapPoint to the"
  72.    PRINT " cursor, ADD a new point at the cursor, or DELETE the MapPoint.  The G key will"
  73.    PRINT " GO to the MapPoint and conversly, F will FIND the point nearest the cursor."
  74.    PRINT
  75.    PRINT " CAUTION, THIS PROGRAM IS NOT PERFECT... KEEP BACKUPS!  Do a little at a time!"
  76.    PRINT
  77.    COLOR 14, 8
  78.    PRINT
  79.    PRINT " CHANGES IN Version 6.3:"
  80.    PRINT
  81.    PRINT " 1. Ken Swaggart has refined his tools for converting 100,000 USGS data to"
  82.    PRINT "    the same format used by MAPFIXER for 2,000,000 data.  See CDROM.txt."
  83.    PRINT
  84.    PRINT " 2. MAPFIXER now uses the smaller VGA fonts and alternate screen for the map"
  85.    PRINT "    and HELP screens.  Therefore it will NO LONGER run on CGA screens"
  86.    PRINT
  87.    PRINT " 3. County Lines are now in a better color of ORANGE"
  88.   
  89.    COLOR 15, 8
  90.  
  91.    LOCATE BLn, 1: PRINT " HIT ANY KEY to continue...";
  92.    GOSUB GetChar: SOUND 800, 3
  93.   
  94. Info2:   CLS : COLOR 10, 4
  95.    PRINT " PAGE 2 INSTRUCTIONS:  More about MAPFIX"
  96.    COLOR 15, 4
  97.    PRINT
  98.    PRINT " With MAPFIX.bas, you can modify features by moving, adding or deleting POINTS"
  99.    PRINT " or Killing whole features, ie: roads, rivers, borders, etc. "
  100.    PRINT
  101.    PRINT " If the MapPointer and FeatureName get out of sequence, the RESET command may"
  102.    PRINT " fix them, but you should save the file immediately and check it with an editor."
  103.    PRINT
  104.    PRINT " Using the IMPORT command, you can IMPORT features from many smaller maps"
  105.    PRINT " into one larger map, or you can take points out of adjacent maps and put them"
  106.    PRINT " into yours.  Only the points that fit within the current WHITE center-&-range"
  107.    PRINT " BORDER will be imported. "
  108.    PRINT
  109.    PRINT " The TRIM command is sort of the converse of IMPORT.  It will TRIM all points"
  110.    PRINT " outside of the white RANGE box.  ";
  111.    PRINT
  112.    PRINT " The MAPLIST command shows your MAPLIST.map file; and the OTHER MAPS command"
  113.    PRINT " shows all MAP borders so you can see how your new map fits in.  You may use F3"
  114.    PRINT " and F4 keys to select smaller or larger map borders to draw."
  115.    LOCATE BLn, 1: PRINT " HIT ANY KEY to continue...";
  116.    GOSUB GetChar: SOUND 800, 3
  117.   
  118. Info3:   CLS : COLOR 14, 3
  119.    PRINT " PAGE 3 INSTRUCTIONS:  Using GPS Track History Files to draw maps!"
  120.    COLOR 15, 3
  121.    PRINT
  122.    PRINT " To aid in creating accurate maps, W7KKE in Calif figured out how to overlay a"
  123.    PRINT " GPS Track History file into MAPFIX.  Use this to build and fix your own maps!"
  124.    PRINT ""
  125.    PRINT " After you have loaded your map, type alt-G (GPS Track History') and enter the"
  126.    PRINT " history filename.  This will overlay the track history file.  You may then"
  127.    PRINT " use the normal MAPFIX.bas routines to move map segments and add so that the"
  128.    PRINT " map will agree with the GPS data contained in the track history file.  This"
  129.    PRINT " is especially useful with the history files saved by a laptop during mobile"
  130.    PRINT " GPS operations."
  131.    PRINT
  132.    PRINT " CAUTION:  Since GPS data is only accurate to 100 yards due to the effects of"
  133.    PRINT " Selective Availability, I would avoid using GPS data explicitely below about"
  134.    PRINT " the 2 mile range.  For this reason, I make the size of the GPS positions "
  135.    PRINT " expand below the 2 mile range to roughly approximate the size of the 100 yard"
  136.    PRINT " error circle."
  137.    PRINT
  138.    PRINT " Note that you can START a NEW map from scratch by just typing NEW instread "
  139.    PRINT " of a MAP filename when starting up the program."
  140.    LOCATE BLn, 1: PRINT " HIT ANY KEY to continue...";
  141.    GOSUB GetChar: SOUND 800, 3
  142.  
  143.  
  144. Info4:   COLOR 14, 1: CLS
  145.    PRINT " PAGE 4 INSTRUCTIONS FOR USING A DIGITIZER:": PRINT
  146.    COLOR 15, 1
  147.    PRINT " MAPFIX.bas can also accept the serial data from a digitizer tablet or table"
  148.    PRINT " thanks again to W7KKE.  THIS IS THE MOST ACCURRATE WAY TO BUILD MAPS! "
  149.    PRINT
  150.    PRINT " To use a digitizer, first you must hit the ALT-O command to open the COMM"
  151.    PRINT " PORT for the digitizer.  This command also lets you test the digitizer while"
  152.    PRINT " testing the alignment of the map on the digitizer surface.  It then prompts"
  153.    PRINT " you to identify the upper left and lower right corners of the map, in order"
  154.    PRINT " to calibrate the digitizer to the latitude, longitude and scale of the map."
  155.    PRINT : COLOR 14, 1
  156.    PRINT " From this point on, the 0 button on the digitizer mouse, or the PEN is the same"
  157.    PRINT " as the ALT-A ADD command.  Points will be added AFTER the current map point."
  158.    PRINT " To start a new map feature, you must first move the cursor to the new starting"
  159.    PRINT " point, before using the ALT-N NEW command.  There are 3 ways to move the cursr"
  160.    PRINT " 1) arrow keys, 2) fourth button on a 4 button mouse, 3) press F1 and then use"
  161.    PRINT " the mouse or Pen (once for each press of F1).  OR you may use the alt-B BEGIN"
  162.    PRINT " command which does NOT require the cursor to be moved first."
  163.    PRINT : COLOR 15, 1
  164.    PRINT " To speed up the screen during editing, MAPFIX does not erase and re-draw the"
  165.    PRINT " entire map after each new point, but only draws the new line segment.  While"
  166.    PRINT " editing points, the old line remains until you draw a new map.              "
  167.    PRINT
  168.  
  169.   
  170.    Display$ = "UNKnown"
  171.    RETURN
  172.  
  173. GetChar: a$ = "": DO UNTIL a$ <> "": a$ = INKEY$: LOOP: RETURN
  174.  
  175. BEGIN: GOSUB Info:
  176.    PRINT " HIT ANY KEY to proceed onto the HELP screen...";
  177.    GOSUB GetChar
  178.  
  179.    DIM x%(6 * MaxNumPoints), y%(6 * MaxNumPoints)
  180.    REM MAP coordinates               **** THESE ARE BIGGER THAN APRS ***
  181.    DIM LN$(MaxNumLines) ' (no limit in APRS)  **** SO YOU CAN MANIPULATE BIG MAPS
  182.    nn = 2 * MaxNumLABELS
  183.    DIM ML$(nn), MLa(nn), MLo(nn), MLr(nn) 'Map Labels, lengths and coordinates
  184.    nn = 2 * MaxNumMAPS
  185.    DIM MapName$(nn), LatCen(nn), LonCen(nn), MapMax(nn), Comment$(nn)
  186.    RdsOn = -1: Labls = -1: Tags = -1: KP = 1: Changed = 0: MapSize = 256
  187.    i = 1000
  188.    DIM HLAT(i), HLONG(i)'For lat/longs from big GPS history files
  189.  
  190. INIT: ON ERROR GOTO ErrorTrap
  191.    ReDraw = -1
  192.  
  193. SCREEN , , 0, 0: Display$ = "HELP": GOSUB HELP: GOSUB LoadMap
  194. REM ON ERROR GOTO 0
  195.  
  196. Main: GOSUB DrwMPaCur
  197.   DO
  198. GoAgain: Fault = 0
  199.     IF Digitizer THEN
  200.        IF LOC(1) > 9 THEN
  201.           GOSUB GetXY
  202.           IF JustCur OR Btn = 3 THEN
  203.              GOSUB Cursor: GOSUB DrwMpPt'and clears JustCur
  204.           ELSE GOSUB Cursor: GOSUB AddPoint'If BTN 3, then do nothing.  But
  205.           END IF
  206.        END IF                             'of course that still moves cursor
  207.     END IF
  208.     a$ = ""
  209.     IF Mouse THEN
  210.        IF LOC(1) > 2 THEN
  211.        c$ = INPUT$(1, 1)
  212.        IF c$ > CHR$(191) THEN
  213.          a = ASC(c$) - 192
  214.          x = 0: y = 0
  215.          c$ = INPUT$(1, 1): IF c$ > CHR$(127) THEN x = ASC(c$) - 128
  216.          c$ = INPUT$(1, 1): IF c$ > CHR$(127) THEN y = ASC(c$) - 128
  217.          IF x > 31 THEN x = x - 64
  218.          IF y > 31 THEN y = y - 64
  219.          CPX = CPX - x * degpmh
  220.          CPY = CPY - y * degpmv
  221.          GOSUB Cursor
  222.          IF a > 31 THEN a = a - 32: a$ = CHR$(0) + CHR$(30)
  223.          IF a > 15 THEN a = a - 16: a$ = "F"
  224.        END IF
  225.      END IF
  226.     END IF
  227.     IF a$ = "" THEN a$ = INKEY$
  228.     IF a$ <> "" THEN
  229.        a$ = UCASE$(a$): Key$ = a$
  230.        SELECT CASE a$
  231.        CASE "Y": SCREEN , , 0, 0
  232.        CASE "Z": SCREEN , , 1, 1
  233.        CASE "S": GOSUB labels
  234.        CASE "L": Labls = NOT Labls
  235.        CASE "T": Tags = NOT Tags
  236.        CASE "F": LnStrt = 0: StrtSrch = 1: GOSUB FindPoint
  237.        CASE CHR$(6): LnStrt = LnPtr: StrtSrch = z + 1: GOSUB FindPoint
  238.        CASE "G": GOSUB CurToPoint: GOSUB CurDrwMap
  239.        CASE "H"
  240.           IF Display$ <> "HELP" THEN
  241.              SCREEN , , 0, 0: COLOR 15, 1: GOSUB HELP
  242.           ELSE GOSUB Info
  243.              LOCATE BLn, 1: PRINT " H for HELP or SPACE BAR for map..."; : a$ = ""
  244.           END IF
  245.        CASE "B": GOSUB BoxPPD
  246.        CASE "U": GOSUB GetUSGS
  247.        CASE "D": GOSUB MapDIR
  248.        CASE "M": GOSUB ListMAPlist
  249.        CASE "O": GOSUB DrwAndShow
  250.        CASE "N": GOSUB NextLine: GOSUB Cursor
  251.        CASE "P": GOSUB Previous: GOSUB Cursor
  252.        CASE "Q": GOSUB QUIT
  253.        CASE "R": z = 2: LnPtr = 1
  254.        CASE "T": GOSUB Scrunch
  255.        CASE " "
  256.                  Display$ = "MAP": ReDraw = -1: USGS = 0:
  257.                  IF Scrn = 0 THEN SCREEN , , 1, 1: COLOR 15, 0
  258.                  IF Scrn = 1 THEN GOSUB DrwMPaCur
  259.                  Scrn = 1
  260.        CASE "+": z = z + 1: GOSUB MapPoint  ' moves to next map point
  261.        CASE "-": z = z - 1: GOSUB MapPoint  ' moves backwards
  262.        CASE CHR$(18): ReDraw = NOT ReDraw: GOSUB ReDraw
  263.        CASE "7": CDX = LONo: CDY = LATo: GOSUB DrwMPaCur 'ShiftHOME
  264.        CASE "6": CPX = CPX - 20 / (Sfac): GOSUB Cursor 'SHIFT Cursor by 4
  265.        CASE "4": CPX = CPX + 20 / (Sfac): GOSUB Cursor
  266.        CASE "8": CPY = CPY + 20 / (Sfac): GOSUB Cursor
  267.        CASE "2": CPY = CPY - 20 / (Sfac): GOSUB Cursor
  268.  
  269.        END SELECT
  270.       
  271.        B$ = "": IF LEN(a$) = 2 THEN B$ = RIGHT$(a$, 1): REM process arrow & special keys
  272.        SELECT CASE B$
  273.        CASE "I": RS = RS * 2: GOSUB CurDrwMap: REM change scale
  274.        CASE "Q": RS = RS / 2: GOSUB CurDrwMap
  275.        CASE CHR$(132): RS = RS * 8: GOSUB CurDrwMap: REM change scale by factor of 4
  276.        CASE "V": RS = RS / 8: GOSUB CurDrwMap
  277.        CASE "G": GOSUB CurDrwMap 'Home key
  278.        
  279.        CASE "O": CDX = LonCen: CDY = LatCen: GOSUB DrwMPaCur 'End Key
  280.        CASE "M": CPX = CPX - 4 / (Sfac): GOSUB Cursor
  281.        CASE "K": CPX = CPX + 4 / (Sfac): GOSUB Cursor
  282.        CASE "H": CPY = CPY + 4 / (Sfac): GOSUB Cursor
  283.        CASE "P": CPY = CPY - 4 / (Sfac): GOSUB Cursor
  284.        REM Here are the special MapFIx routines
  285.        CASE CHR$(30)   '    alt-A   (also left mouse button!)
  286.           SELECT CASE MsInit
  287.           CASE 0: GOSUB AddPoint              'alt-ADD point
  288.           CASE 4: LAb = CPY
  289.           CASE 3
  290.                 GOSUB BoxLine23: BEEP
  291.                 INPUT "Enter total LAT moved in Degrees"; z$
  292.                 degpmv = VAL(z$) / (Sfac * (CPY - LAb))
  293.           CASE 2: LOb = CPX
  294.           CASE 1
  295.                 GOSUB BoxLine23: BEEP
  296.                 INPUT "Enter total LONG moved in Degrees"; z$
  297.                 degpmh = VAL(z$) / (Sfac * (CPX - LOb))
  298.           END SELECT
  299.           IF MsInit THEN MsInit = MsInit - 1
  300.        
  301.        CASE CHR$(48): IF Digitizer THEN GOSUB NewFeature'alt-BEGIN
  302.        CASE CHR$(34): GOSUB LoadHst                'alt-GPS hstry file
  303.        CASE CHR$(50): GOSUB MakePT: IF ReDraw THEN GOSUB DrawMap 'MOVE point to cursor
  304.        CASE CHR$(32): GOSUB DelPT                  'alt-DELete point
  305.        CASE CHR$(38): GOSUB AddLabel               'alt-ADD LABEL
  306.        CASE CHR$(46): GOSUB NewCenter              'alt-CENTER
  307.        CASE CHR$(23): GOSUB IMPORT                 'alt-IMPORT
  308.        CASE CHR$(36): GOSUB Join                   'alt-JOIN
  309.        CASE CHR$(37): GOSUB KillF                  'alt-KILL Feature
  310.        CASE CHR$(19): GOSUB MapRange               'alt-RANGE
  311.        CASE CHR$(20): GOSUB TRIM                   'alt-TRIM
  312.        CASE CHR$(49): GOSUB NewFeature             'alt-NEW Feature
  313.        CASE CHR$(24): GOSUB WhichDgtzr             'alt-OPEN dgtzr COM
  314.        CASE CHR$(31): GOSUB Scrunch                'alt-SCRUNCH
  315.        CASE CHR$(22): GOSUB GetUSGS                'alt-U
  316.        CASE CHR$(59): JustCur = -1: GOSUB DrwMpPt  'F1
  317.        CASE CHR$(60): GOSUB MapCnvrt               'F2
  318.        CASE CHR$(61)                               'F3 for smaller Maps
  319.           MapSize = MapSize / 2: IF MapSize < 1 THEN MapSize = 1
  320.           GOSUB ShowMaps
  321.        CASE CHR$(62)                               'F4 for larger Maps
  322.           MapSize = MapSize * 2: IF MapSize > 1000 THEN MapSize = 1000
  323.           GOSUB DrwAndShow
  324.        CASE CHR$(66): GOSUB AddMark                'F8
  325.        CASE CHR$(67): GOSUB InitMouse              'F9
  326.        CASE CHR$(19): GOSUB SaveMap
  327.        CASE CHR$(3): GOSUB ChgColr
  328.        END SELECT
  329.           
  330.     END IF
  331.   LOOP
  332.   SYSTEM 'you should never get here
  333.  
  334. AddMark: a$ = "Ref Point": SavClr = 14
  335.    GOSUB BeginF: GOSUB MakePT
  336.    CUY = CUY - 6: GOSUB AddPoint
  337.    CUX = CUX + 10: GOSUB AddPoint
  338.    CUY = CUY + 6: GOSUB AddPoint
  339.    CUX = CUX - 10: GOSUB AddPoint
  340.    CUY = CUY - 6: GOSUB AddPoint
  341.    CUX = CUX + 5: CUY = CUY + 3: GOSUB Cursor
  342.    RETURN
  343.  
  344. WhichDgtzr: GOSUB BoxLine23
  345.    INPUT "Select (D)igitizer or (P)oor-Man's-Mouse-Mode"; a$
  346.    a$ = UCASE$(a$): IF a$ = "D" THEN GOSUB DigiInit: GOTO DrawMap
  347.    IF a$ <> "P" THEN RETURN
  348.    IF NOT Mouse THEN GOSUB InitMouse
  349.    CLS : LOCATE 6, 1
  350.    PRINT "POOR-MANS-MOUSE-MODE  (Digitizer)"
  351.    PRINT
  352.    PRINT "We must first calibrate the mouse movement with actual LAT/LONG movements."
  353.    PRINT "Perform the following steps in sequence.  If you mess up, START PROGRAM OVER!"
  354.    PRINT
  355.    PRINT "During this process, ignore the cursor on the screen."
  356.    PRINT
  357.    PRINT "Lift and move mouse to a low LATTITUDE mark.  Hit left button."
  358.    PRINT "     move mouse carefully up to an UPPER LATTITUDE mark.  Hit left button."
  359.    PRINT
  360.    PRINT "Lift and move mouse to a right LONGITUDE mark.  Hit left button."
  361.    PRINT "     move mouse carefully to a LEFT LONGITUDE mark.  Hit left button."
  362.    MsInit = 4
  363.    RETURN
  364.  
  365.  
  366.  
  367. InitMouse: GOSUB BoxLine23
  368.     INPUT "Mouse on COM 1, 2 or None"; a$
  369.     IF a$ = "1" OR a$ = "2" THEN
  370.        OPEN "com" + a$ + ":1200,n,8,1,CS0,DS0,CD0" FOR RANDOM AS #1
  371.        Mouse = -1
  372.        GOSUB BoxLine23
  373.        PRINT "Left button is alt-ADD.  Right button is FIND."; ""
  374.        degpmh = 1 / Sfac: degpmv = 1 / Sfac
  375.     END IF
  376.     RETURN
  377.  
  378. ReDraw: LOCATE 1, 30
  379.     IF ReDraw THEN PRINT "REDRAW ENABLED":  ELSE PRINT "NO ReDraw...  "
  380.     RETURN
  381.  
  382. QUIT: a$ = "Y"
  383.     IF Changed THEN
  384.        GOSUB BoxLine23
  385.        PRINT "**** MAP HAS BEEN MODIFIED"; Changed; "TIMES BUT NOT SAVED!!!  SAVE NOW? (Y)";
  386.        INPUT a$
  387.     IF UCASE$(a$) <> "N" THEN GOSUB SaveMap
  388.     END IF
  389.     SYSTEM
  390.  
  391. TRIM: GOSUB BoxLine23
  392.     CLS : PRINT "TRIM ALL POINTS AND LABELS OUTSIDE OF MAPRANGE"
  393.     PRINT
  394.     PRINT "This command will remove all points and labels that are outside of the white"
  395.     PRINT "map border.  You can change the location of this map border by using"
  396.     PRINT "the CENTER command (alt-C) and by changing the RANGE using alt-R."
  397.     PRINT : PRINT
  398.     PRINT "I would recommend making the white boarder about 10 to 20% larger than the"
  399.     PRINT "final desired size.  This is to avoid errors near the edge."
  400.     PRINT
  401.     PRINT "You might consider stopping now and doing a SAVE (ctrl-S) before proceeding."
  402.     PRINT
  403.     PRINT "ALSO, THIS DOES NOT WORK FOR POINTS WITH NEGATIVE VALUES!  Be sure  your"
  404.     PRINT "selected area is below and to right of ORIGIN.  If not, run MAPCNVRT.bas."
  405.     PRINT : PRINT
  406.     INPUT "Are you ready to proceed? (Y/N) (N)"; ans$
  407.     GOSUB DrawMap
  408.     IF UCASE$(ans$) <> "Y" THEN RETURN
  409.     c = 0: LOCATE BLn - 2, 1: PRINT "Processing...";
  410.     REM dx and dy are num pix of center of map
  411.     REM bx and by are borders of map based on MapRng
  412.     by = ppdv * MapRng / 60
  413.     bx = by / Lfac
  414.     z = 0
  415.     DO
  416.       z = z + 1
  417.       IF x%(z) = 0 THEN z = z + 2
  418.       IF x%(z) > dx + bx OR y%(z) > dy + by THEN bad = 1 ELSE bad = 0
  419.       IF x%(z) < dx - bx OR y%(z) < dy - by THEN bad = 1
  420.       IF bad THEN
  421.          REM IF x%(z - 1) <> 0 AND x%(z + 1) <> 0 THEN
  422.             GOSUB DelPT: z = z - 1
  423.             c = c + 1
  424.          REM END IF
  425.       END IF
  426.       IF z >= nmp - 4 THEN EXIT DO
  427.     LOOP
  428.     LOCATE BLn - 2, 1: PRINT "Now removing labels...";
  429.     FOR i = 1 TO nml: REM now eliminate all labels outside
  430.         bad = 0: Xm = MapRng / (60 * Lfac): Ym = MapRng / 60
  431.         IF MLo(i) > LonCen + Xm OR MLa(i) > LatCen + Ym THEN bad = 1
  432.         IF MLo(i) < LonCen - Xm OR MLa(i) < LatCen - Ym THEN bad = 1
  433.         IF bad = 1 THEN
  434.            FOR j = i TO nml
  435.                ML$(j) = ML$(j + 1): MLa(j) = MLa(j + 1)
  436.                MLo(j) = MLo(j + 1): MLr(j) = MLr(j + 1)
  437.            NEXT j: nml = nml - 1: PRINT ".";
  438.         END IF
  439.     NEXT i
  440.     GOTO DrawMap
  441.    
  442. FindPoint: CurX = INT(.5 + dx + (CUX - 320) / (KP * Hfac))
  443.            CurY = INT(.5 + dy + (CUY - Ycen) / KP)
  444.  
  445.     GOSUB BoxLine23: PRINT "SEARCHING THROUGH ALL POINTS IN FILE...";
  446.     REM SaveZ = Z: SaveLNptr = LnPtr
  447. Agn: FOR j = 0 TO 30            ' Go through abt 20 times lookin pt.
  448.         IF j > 10 THEN j = j + 1' first with 0 delta, then bigger
  449.         PRINT ".";
  450.         LnCtr = LnStrt
  451.         FOR i = StrtSrch TO nmp
  452.             IF x%(i) = 0 THEN LnCtr = LnCtr + 1
  453.             IF LnCtr >= LNi THEN i = nmp
  454.             IF x%(i) > CurX - j AND x%(i) < CurX + j THEN
  455.                IF y%(i) > CurY - j AND y%(i) < CurY + j THEN
  456.                   z = i: LnPtr = LnCtr: GOSUB CurToPoint
  457.                   j = 99: i = nmp
  458.                END IF
  459.             END IF
  460.         NEXT i:
  461.     NEXT j
  462.     IF j < 99 AND Key$ = CHR$(6) THEN StrtSrch = 2: LnCtr = 1: Key$ = "F": GOTO Agn
  463.     IF j < 99 THEN PRINT "None found!": RETURN
  464.     GOSUB MapPoint: SavClr = 0: RETURN
  465.                   
  466. NewFeature: LOCATE BLn - 1, 1: PRINT SPACE$(27); : GOSUB BoxLine23
  467.     INPUT "Enter reference name for new feature"; a$
  468.     IF a$ = "" THEN RETURN
  469.     GOSUB Rainbow: IF abort THEN RETURN
  470.     GOSUB BeginF
  471.     GOSUB BoxLine23
  472.     LOCATE BLn, 1: PRINT SPACE$(80); : LOCATE BLn, 1
  473.     IF RIGHT$(Key$, 1) = CHR$(48) THEN
  474.        PRINT "NOW USE DIGITIZER TO ADD NEW POINTS TO THIS FEATURE...";
  475.        GOSUB GetXY: GOSUB Cursor
  476.     ELSE
  477.        PRINT "NOW MOVE CURSOR AND USE ALT-A TO ADD POINTS TO THIS NEW FEATURE...";
  478.     END IF
  479.     GOSUB MakePT
  480.     RETURN
  481.  
  482. Rainbow: LOCATE BLn, 1
  483.     FOR i = 0 TO 14
  484.         PRINT RIGHT$(" " + MID$(STR$(i + 1), 2), 2); "   ";
  485.         LINE (16 + i * 40, 335 * YfacTXT)-(40 + i * 40, 349 * YfacTXT), i + 1, BF
  486.     NEXT i
  487.     GOSUB BoxLine23
  488.     INPUT "Select color (4,7,10-Hwys 11-Water 12-Hwy 13-Spcl 14-City)"; B$
  489.     SavClr = VAL(B$): IF SavClr > 15 OR SavClr < 1 THEN abort = -1 ELSE abort = 0
  490.     RETURN
  491.  
  492.            
  493. BeginF: x%(nmp) = 0: y%(nmp) = SavClr   'Store feature color 0,c
  494.     LN$(LNi + 1) = LN$(LNi): LnPtr = LNi'Bump up present LN$ comment
  495.     LN$(LNi) = a$: LNi = LNi + 1'Store feature name
  496.     nmp = nmp + 1: z = nmp
  497.     nmp = nmp + 1: x%(nmp) = 0: y%(nmp) = 0'nmp points to ending 0,0
  498.     RETURN
  499.  
  500. CanclF: nmp = nmp - 2: z = Kz
  501.     LNi = LNi - 1: LN$(LNi) = LN$(LNi + 1): RETURN
  502.  
  503. NewCenter: LatCen = CPY: LonCen = CPX: Changed = Changed + 1: GOTO CurDrwMap
  504.  
  505. MapRange: GOSUB BoxLine23: INPUT "Enter map range"; a$
  506.     IF VAL(a$) <> 0 THEN MapRng = VAL(a$)
  507.     Changed = Changed + 1: GOTO DrwMPaCur
  508.  
  509. AddPoint: x% = dx + (CUX - 320) / (KP * Hfac)
  510.     IF x% = 0 THEN BEEP: PRINT "X=0!!!": RETURN
  511.     nmp = nmp + 1: z = z + 1
  512.     FOR i = nmp TO z STEP -1
  513.         x%(i) = x%(i - 1): y%(i) = y%(i - 1)
  514.     NEXT
  515.     GOSUB MakePT
  516.     IF SavClr = 0 AND ReDraw THEN GOTO DrawMap
  517.     s = z - 1: LineColor = SavClr: GOTO DP
  518.  
  519. MakePT: x%(z) = dx + (CUX - 320) / (KP * Hfac)
  520.     y%(z) = dy + (CUY - Ycen) / KP
  521.     Changed = Changed + 1
  522.     GOTO MapPoint
  523.  
  524. CurToPoint:
  525.     CPX = CDX - (x%(z) - dx) / ppdv
  526.     CPY = CDY - (y%(z) - dy) / (ppdv * Yfactr)
  527.     GOTO Cursor
  528.  
  529. DelPT: GOSUB DelZ
  530.     REM if 1st pt, it stays as 1st pt
  531.  
  532.     IF x%(z) = 0 THEN z = z - 1: REM if end pt, it stays as end
  533.     IF x%(z + 1) = 0 AND x%(z - 1) = 0 THEN 'It is LAST point
  534.        GOSUB Kline: LnPtr = LnPtr - 1       'So Kill Line
  535.        GOSUB DelZ                           'And Kiil it
  536.        z = z - 1: GOSUB DelZ: z = z - 1     'Kill 0,color
  537.     END IF                                  'and -1 to end point
  538.     IF B$ = CHR$(32) AND ReDraw THEN GOSUB DrawMap ELSE GOSUB MapPoint
  539.     RETURN
  540.  
  541. DelZ: nmp = nmp - 1
  542.       FOR i = z TO nmp
  543.           x%(i) = x%(i + 1): y%(i) = y%(i + 1)
  544.       NEXT: Changed = Changed + 1: RETURN
  545.  
  546. NextLine: IF z >= nmp - 1 THEN z = nmp - 1: BEEP: RETURN
  547.     DO UNTIL x%(z) = 0: z = z + 1: LOOP
  548.     IF z < nmp - 1 THEN z = z + 1: LnPtr = LnPtr + 1
  549.     SavClr = 0: GOTO MapPoint
  550.  
  551. Previous: DO UNTIL z = 1 OR x%(z) = 0: z = z - 1: LOOP
  552.     IF z > 3 THEN z = z - 1: LnPtr = LnPtr - 1
  553.     SavClr = 0: GOTO MapPoint
  554.  
  555. KillF: GOSUB Find1st: REM Stop at Beginning (0) point of the feature to kill
  556.     ni = Bi + 1' Now scan for next feature
  557.     DO UNTIL x%(ni) = 0: ni = ni + 1: LOOP
  558.     REM now move down rest of array to fill
  559.     DO UNTIL ni = nmp + 1
  560.        x%(Bi) = x%(ni): y%(Bi) = y%(ni)
  561.        Bi = Bi + 1: ni = ni + 1
  562.     LOOP
  563.     nmp = nmp - (ni - Bi): y%(nmp) = 0
  564.     GOSUB Kline
  565.     GOTO DrawMap
  566.     
  567. Find1st: Bi = z: Changed = Changed + 1
  568.     DO UNTIL x%(Bi) = 0: Bi = Bi - 1: LOOP: z = Bi + 1
  569.     RETURN
  570.  
  571. ChgColr: GOSUB Find1st: GOSUB Rainbow: IF abort THEN RETURN
  572.          y%(Bi) = SavClr: RETURN
  573.  
  574.  
  575. Kline: FOR i = LnPtr TO LNi
  576.            LN$(i) = LN$(i + 1)
  577.        NEXT i
  578.        LNi = LNi - 1
  579.        RETURN
  580.  
  581. MapPoint:
  582.      IF z < 2 THEN z = 2: LnPtr = 1: BEEP: SavClr = 0
  583.      IF z > nmp - 1 THEN z = z - 1: BEEP: SavClr = 0
  584.      IF x%(z) = 0 THEN
  585.         IF a$ = "-" THEN
  586.              LnPtr = LnPtr - 1: z = z - 1
  587.         ELSE LnPtr = LnPtr + 1: z = z + 1
  588.         END IF: SavClr = 0
  589.      END IF
  590.      IF LnPtr < 0 THEN LnPtr = 0
  591.      IF Display$ = "MAP" THEN
  592.           LOCATE BLn - 3, 1
  593.           PRINT "Fture#"; LnPtr; TAB(12); LEFT$(LN$(LnPtr) + "            ", 12);
  594.      END IF
  595. DrwMpPt: IF Display$ <> "MAP" THEN RETURN
  596.      IF JustCur THEN pc = 12 ELSE pc = 15
  597.      CIRCLE (Xtest, Ytest), 10, 0 'Erase old circle
  598.      Xtest = 320 + KP * (x%(z) - dx) * Hfac
  599.      Ytest = Ycen + KP * (y%(z) - dy) * Yfactr
  600.      CIRCLE (Xtest, Ytest), 10, pc
  601.      
  602.      LOCATE BLn - 2, 1: PRINT "MapPt#"; z;
  603.      IF z > 999 THEN PRINT TAB(13); "val:";  ELSE PRINT TAB(12); "vals:";
  604.      PRINT TAB(17); x%(z); TAB(23); y%(z)
  605.      RETURN
  606.  
  607. AddLabel: nml = nml + 1
  608.      MLa(nml) = CPY: MLo(nml) = CPX
  609.      GOSUB BoxLine23: INPUT "Enter Label Name"; a$: ML$(nml) = a$
  610.      GOSUB BoxLine23: INPUT "Begin displaying label at what range?"; a$
  611.      a = VAL(a$): IF a <> 0 THEN MLr(nml) = a:  ELSE MLr(nml) = 2048
  612.      Changed = Changed + 1: GOTO labels
  613.  
  614. BoxLine23: LOCATE BLn - 2, 1: PRINT SPACE$(80); : LOCATE BLn - 2, 1: RETURN
  615.  
  616. ErrorTrap: Fault = ERR: 'Error handling routine
  617.      IF ERR = 57 THEN PRINT "  I/O-error-User-logoff"; : RESUME
  618.      IF ERR = 69 THEN PRINT "  Comm-buffer-overflow"; : RESUME
  619.      IF ERR = 53 THEN PRINT "  file-"; F$; "-not-found": CLOSE : RESUME NEXT
  620.      IF ERR = 62 THEN RESUME NEXT
  621.      IF ERR = 64 THEN RESUME NEXT
  622.      IF ERR = 52 THEN RESUME NEXT
  623.      IF ERR = 55 THEN RESUME NEXT
  624.      IF ERR = 2 THEN PRINT "SYNTAX-error"
  625.      IF ERR = 70 THEN PRINT " WRITE PROTECTED!...": RESUME NEXT
  626.      IF ERR = 76 THEN PRINT "Wrong Path!": RESUME NEXT
  627.      IF ERR = 71 THEN PRINT "no disk!": RESUME NEXT
  628.      RESET
  629.      PRINT : PRINT "Error beyond repair. Number = "; ERR;
  630.      INPUT "Hit RETURN to return to DOS"; a$
  631.      SYSTEM
  632.  
  633. MapDIR: CLS : PRINT "MAP FILES DIRECTORY": PRINT
  634.      PRINT "To display MAP files, please enter the path to your xxxxxxx.MAP files."
  635.      PRINT "For example, the default '\APRS\MAPS\*.MAP' will show all maps in the APRS"
  636.      PRINT "directory.  Similarly '*.map' will search your present QB directory."
  637.      PRINT "For any other path, enter the full file specification.": PRINT
  638.      F$ = "\aprs\MAPS\*.map"
  639.      PRINT "Enter Filespec for searching the DIRECTORY ("; F$; ")";
  640.      INPUT a$: IF a$ <> "" THEN F$ = a$
  641.      PRINT : PRINT : FILES F$
  642.      RETURN
  643.  
  644.  
  645. LoadMap: 'Maps are drawn to the default EGA resolution of 640 x 400 (350)
  646. Again: GOSUB BoxLine23
  647.       
  648.     INPUT " Enter map FILENAME, or NEW, or ? for a list, or Q to quit)"; a$
  649.     a$ = UCASE$(a$): IF a$ = "" THEN GOTO Again
  650.     IF a$ = "Q" THEN SYSTEM
  651.     IF a$ = "?" THEN GOSUB MapDIR: GOTO Again
  652.     IF a$ = "NEW" THEN Key$ = "NEW": GOSUB NewMap: RETURN
  653.     a = INSTR(3, a$, "."): IF a = 0 THEN a$ = a$ + ".MAP"
  654.     MapFile$ = a$: F$ = MapFile$: OPEN F$ FOR INPUT AS #3
  655.     IF Fault = 53 THEN Fault = 0: PRINT : CLOSE #3: GOTO Again
  656.     GOSUB BoxLine23: PRINT " Loading "; F$; "..."
  657.     INPUT #3, LATo: LINE INPUT #3, LATtext$
  658.     INPUT #3, LONo: LINE INPUT #3, LONtext$
  659.     INPUT #3, ppdv: LINE INPUT #3, VS$'Pixels per degree horiz
  660.     INPUT #3, LatCen: LINE INPUT #3, LatCen$
  661.     INPUT #3, LonCen: LINE INPUT #3, LonCen$
  662.     INPUT #3, MapRng: LINE INPUT #3, MapRng$
  663.     INPUT #3, MinRng: LINE INPUT #3, MR$
  664.     LINE INPUT #3, TextLine$ ' Line of comments or instrutcitons
  665.     IF LEFT$(TextLine$, 14) = "Map generated " THEN ReDraw = 0
  666.     RS = 2 ^ INT(LOG(MapRng) / LOG(2))'Rng is intgr of VERTrng
  667.     i = 0: LNi = 0:
  668.    
  669.     DO WHILE NOT EOF(3)
  670.        i = i + 1: INPUT #3, x%(i), y: y%(i) = y * Yfactr
  671.        IF x%(i) = 0 AND NOT EOF(3) THEN ' Get line color & store with x=0
  672.           INPUT #3, y%(i): LNi = LNi + 1: LINE INPUT #3, LN$(LNi)' Save line name
  673.           IF y = -1 THEN GOSUB LoadLabels ' All labels listed at end of file
  674.        END IF
  675.     LOOP: nmp = i  'nmp points to 0,-1 that ends all data (but the value
  676.                    'of X% and y% are 0,0 until file is saved.
  677.     CDY = LatCen: CDX = LonCen'Center display on ORIGIN
  678.     CPX = CDX: CPY = CDY 'Cursor Posn to Center of Display
  679.     z = 2: LnPtr = 1: REM start at first point and first line segment
  680.     CLOSE #3:     REM first X% value is map color.  2nd val is 1st pt
  681.     RETURN
  682.  
  683.  
  684. LoadLabels: K = 0
  685.      DO WHILE NOT EOF(3)
  686.         K = K + 1: INPUT #3, ML$(K), MLa(K), MLo(K), MLr(K)
  687.      LOOP
  688.      IF MLa(K) = 0 OR MLo(K) = 0 THEN nml = K - 1 ELSE nml = K
  689.      RETURN
  690.        
  691. SaveMap: GOSUB BoxLine23
  692.    PRINT "Enter file name to save if other than "; MapFile$;
  693.    INPUT a$: IF a$ <> "" THEN MapFile$ = a$
  694.    F$ = MapFile$
  695.    GOSUB BoxLine23: PRINT "Saving map to file named "; F$; " ..."
  696.    OPEN F$ FOR OUTPUT AS #4
  697.    IF Fault = 70 OR Fault = 71 THEN Fault = 0: CLOSE #4: GOTO SaveMap
  698.    PRINT #4, LATo; ","; LATtext$
  699.    PRINT #4, LONo; ","; LONtext$
  700.    PRINT #4, ppdv; ","; VS$
  701.    PRINT #4, LatCen; ","; LatCen$
  702.    PRINT #4, LonCen; ","; LonCen$
  703.    PRINT #4, MapRng; ","; MapRng$
  704.    PRINT #4, MinRng; ","; MR$
  705.    PRINT #4, TextLine$
  706.    j = 1
  707.    FOR i = 1 TO nmp
  708.        IF x%(i) <> 0 THEN WRITE #4, x%(i), INT((y%(i) / Yfactr) + .5)
  709.        IF i = nmp THEN PRINT #4, " 0,-1"  'Used to be AND X%(i)=0
  710.        IF x%(i) = 0 AND i <> nmp THEN
  711.           PRINT #4, "0,0"
  712.           PRINT #4, y%(i); ","; LN$(j): j = j + 1
  713.        END IF
  714.    NEXT i
  715.    PRINT #4, "0,"; LN$(LNi)
  716.    x = 4
  717.    IF ppdv > 60 THEN x = 5
  718.    IF ppdv > 240 THEN x = 6
  719.    IF ppdv > 900 THEN x = 7
  720.    IF ppdv > 2400 THEN x = 8
  721.    FOR K = 1 TO nml
  722.        PRINT #4, ML$(K); ",";
  723.        PRINT #4, LEFT$(LTRIM$(STR$(MLa(K))), x); ",";
  724.        PRINT #4, LEFT$(LTRIM$(STR$(MLo(K))), x + 1); ",";
  725.        PRINT #4, LTRIM$(STR$(MLr(K)))
  726.    NEXT K: CLOSE #4: LOCATE BLn - 1, 1:
  727.    Changed = 0
  728.    IF nmp > MaxNumPoints OR nml > MaxNumLABELS THEN
  729.       CLS : LOCATE 9, 29: PRINT "CAUTION!": PRINT : PRINT
  730.       IF nmp > MaxNumPoints THEN
  731.          PRINT "            The number of points,"; nmp; "is greater than"; MaxNumPoints
  732.       END IF
  733.       IF nml > MaxNumLABELS THEN
  734.          PRINT "            The number of LABELS,"; nml; "is greater than"; MaxNumLABELS
  735.       END IF
  736.       LOCATE 18, 12
  737.       PRINT " Therefore this map will not work with APRS (yet) "
  738.       LOCATE BLn - 2, 1: INPUT "HIT Enter to continue..."; a$
  739.    END IF: GOTO DrwMPaCur
  740.  
  741. CurDrwMap: CDX = CPX: CDY = CPY: GOTO DrawMap: REM Re-center at CURSOR location
  742.  
  743. DrwMPaCur: CPX = CDX: CPY = CDY: GOSUB DrawMap
  744.            REM After drawing map, Put cursor at center
  745.            RETURN
  746.  
  747. DrawMap: IF USGS THEN RETURN
  748.     SCREEN , , 1, 1: Scrn = 1: CLS
  749.     Display$ = "MAP"
  750.     COLOR 15, 0
  751.     WIDTH 80, GBLn: BLn = GBLn
  752.    'Draw to range scale RS and center display CDX and CDY
  753.    'Original Map was 40 pix-per-deg Horiz and 20 vert for 200 display
  754.    'Now ppdH and ppdV are variables.  The scaling factor KP is 1 for
  755.    'the original map scale.
  756.    
  757.    DO WHILE RS < 320 / ppdv: RS = RS * 2: LOOP
  758.    IF RS > 8192 THEN RS = 8192
  759.    KP = 100 * 100 / (RS * ppdv)'This is to scale it down from the 120 maps
  760.    Sfac = 50 * 200 / RS        'Till 307 had been 100*120
  761.  
  762.    Lfac = COS(CDY / 57.296)
  763.    Hfac = (640 / 350) * (3 / 4) * Lfac
  764.    dx = ppdv * (LONo - CDX)
  765.    dy = ppdv * (LATo - CDY)
  766.         
  767.    LOCATE 1, 2: PRINT "Redrawing Map"
  768.    REM first put ORIGIN and map CENTER on the map
  769.    LINE (320 - KP * dx, Ycen - KP * dy)-(960 - KP * dx, Ycen - KP * dy), 14
  770.    LINE (320 - KP * dx, Ycen - KP * dy)-(320 - KP * dx, 3 * Ycen - KP * dy), 14
  771.    CMX = 320 + Sfac * (CDX - LonCen) * Hfac'new
  772.    CMY = Ycen + Sfac * (CDY - LatCen) * Yfactr
  773.    LINE (CMX - 27, CMY)-(CMX + 27, CMY), 14
  774.    LINE (CMX, CMY - 20)-(CMX, CMY + 20), 14
  775.    CIRCLE (CMX, CMY), 10, 14
  776.    CIRCLE (320 - KP * dx, Ycen - KP * dy), 12, 14
  777.    s = 0: GOSUB MapPoint: REM Redraw MapPoint
  778.    StrtPt = 0
  779.    
  780. DP: 'I tried to speed it up.            Was  93 before mods
  781.                                       ' then 88 by removing IF ROADS & COLOR=12
  782.     stst = TIMER                      ' then 82(88) with ELSE
  783.     HfacK = KP * Hfac                 ' then 77(82) with LINE
  784.     YfactrK = KP * Yfactr             ' then 77(76) with K (FOR TEXAS.map)
  785.     FOR i = s TO nmp - 1              ' then 77(73) with If StrtPt =-1
  786.        x = 320 + (x%(i) - dx) * HfacK ' then 66/60 with x=,y=
  787.        y = Ycen + (y%(i) - dy) * YfactrK
  788.        x1 = 320 + (x%(i + 1) - dx) * HfacK
  789.        y1 = Ycen + (y%(i + 1) - dy) * YfactrK
  790.        IF StrtPt THEN
  791.           'x = 320 + (x%(i) - dx) * HfacK
  792.           'y = Ycen + (y%(i) - dy) * YfactrK
  793.           PSET (x, y), LineColor
  794.           CIRCLE (x, y), 2, 9: StrtPt = 0
  795.           LINE -(x1, y1), LineColor
  796.        ELSE
  797.           IF x%(i + 1) <> 0 THEN
  798.              LINE -(x1, y1), LineColor
  799.              'IF i = z THEN SavClr = LineColor
  800.           ELSE
  801.              CIRCLE (x, y), 3, 10: StrtPt = -1
  802.              LineColor = y%(i + 1): i = i + 1
  803.              x = 320 + (x%(i + 1) - dx) * HfacK
  804.              y = Ycen + (y%(i + 1) - dy) * YfactrK
  805.  
  806.              IF Display$ = "SHOW" AND LineColor > 8 THEN LineColor = LineColor - 8
  807.           END IF
  808.        END IF
  809.        IF i = z THEN SavClr = LineColor
  810.    NEXT i
  811.    REM LOCATE 20, 1: PRINT TIMER - stst
  812.    GOSUB Cursor
  813.    GOSUB ReDraw
  814.    REM MapPoint went here
  815.    GOSUB DrawHist: REM draw GPS history track
  816.    IF Key$ <> CHR$(0) + CHR$(30) THEN GOSUB ShowBox
  817.    IF Display$ = "SHOW" THEN
  818.       GOSUB ShowMaps
  819.    ELSE
  820.       LOCATE BLn, 1: PRINT "Use +/- to move MAPpoint.  N/P for Next/Previous Feature.  H for HELP!.";
  821.       LOCATE 1, 71 ' was 61
  822.       PRINT "PTS"; nmp ' ; "= "; INT((nmp / MaxNumPoints) * 100); "%";
  823.       LOCATE 2, 71 ' was 61
  824.       PRINT "LBLS "; nml '; "= "; INT((nml / MaxNumLABELS) * 100); "%";
  825.       LOCATE 3, 71: PRINT "PPD"; ppdv
  826.       LOCATE 4, 71: PRINT "Rng"; LEFT$(STR$(MapRng), 5)
  827.    END IF
  828.  
  829. labels:
  830.    IF Labls THEN
  831.       FOR i = 1 TO nml ' Now plot labels on map
  832.       IF RS <= MLr(i) OR Key$ = "S" THEN
  833.          LET x = 320 + Sfac * (CDX - MLo(i)) * Hfac'new
  834.          LET y = Ycen + Sfac * (CDY - MLa(i)) * Yfactr
  835.          IF Tags AND y > Cfactr * Yfactr AND y < BLn * Cfactr * Yfactr AND x > 8 * (LEN(ML$(i)) + 1) AND x < 632 THEN
  836.             LOCATE y / (Cfactr * Yfactr), (x / 8) - LEN(ML$(i)): PRINT ML$(i);
  837.             REM LOCATE y / (14 * Yfactr), (x / 8) - LEN(ML$(i)): PRINT ML$(i);
  838.             END IF
  839.          END IF
  840.       NEXT i
  841.    END IF
  842.    GOSUB ShowMap
  843.    RETURN
  844.          
  845. ShowMap: REM this shows the map boarder of the loaded map
  846.     x = 320 + KP * (CDX - LonCen) * ppdv * Hfac'new
  847.     y = Ycen + KP * (CDY - LatCen) * ppdv * Yfactr
  848.       by = MapRng * Sfac * Yfactr / 60
  849.       bx = by * 640 / (400 * Yfactr) * Lfac'old
  850.       c = 15
  851.     LINE (x - bx, y - by)-(x + bx, y + by), c, B
  852.     RETURN
  853.  
  854. Cursor: JustCur = 0: IF pc = 12 THEN GOSUB DrwMpPt
  855.      REM CIRCLE (CUX, CUY), 4, 0
  856.      IF CUX > 4 AND CUY > 3 AND CUX < 635 AND CUY < 343 * Yfactr THEN PUT (CUX - 4, CUY - 3), Crsr, XOR
  857.      CUX = 320 + Sfac * (CDX - CPX) * Hfac'new
  858.      CUY = Ycen + Sfac * (CDY - CPY) * Yfactr
  859.      REM CIRCLE (CUX, CUY), 4, 14
  860.      IF CUX > 4 AND CUY > 3 AND CUX < 635 AND CUY < 343 * Yfactr THEN PUT (CUX - 4, CUY - 3), Crsr, XOR
  861.      IF CPX > 0 THEN
  862.           x = INT(CPX): Xm = (CPX - x) * 60
  863.      ELSE x = INT(-CPX): Xm = -(CPX + x) * 60
  864.      END IF
  865.      IF CPY > 0 THEN
  866.           y = INT(CPY): Ym = (CPY - y) * 60
  867.      ELSE y = INT(-CPY): Ym = -(CPY + y) * 60
  868.      END IF
  869.      x$ = RIGHT$(STR$(x), 3) + " "
  870.      LOCATE 1, 2: PRINT "RNG"; RIGHT$("   " + STR$(RS), 4) + " Miles"
  871.      LOCATE 2, 2: PRINT "LAT "; y; MID$(STR$(Ym) + "   ", 2, 5)
  872.      LOCATE 3, 2: PRINT "LON "; x$; MID$(STR$(Xm) + "   ", 2, 5)
  873.      
  874.      LOCATE BLn - 1, 1: PRINT "Cursor coordnts:"; TAB(17);
  875.      PRINT INT(.5 + dx + (CUX - 320) / KP); TAB(23); INT(.5 + dy + (CUY - Ycen) / KP);
  876.      REM LOCATE BLn-1, 55: PRINT "Degrees: ";
  877.      REM PRINT LEFT$(STR$(CPY) + " ", 7); LEFT$(STR$(CPX) + "   ", 7);
  878.      LOCATE 1, 16: PRINT "Decimal";
  879.      LOCATE 2, 15: PRINT LEFT$(STR$(CPY) + " ", 8);
  880.      LOCATE 3, 15: PRINT LEFT$(STR$(CPX) + "   ", 8);
  881.      
  882.      LINE (0, 0)-(178, 3 * Cfactr * Yfactr), 12, B'Box around it
  883.      LINE (0, 0)-(116, 3 * Cfactr * Yfactr), 12, B'Box around it
  884.      LET a$ = "": LET B$ = "": RETURN
  885.  
  886. HELP: SCREEN , , 0, 0: Scrn = 0: CLS
  887.       REM WIDTH 80, 25: BLn = 25
  888.       COLOR 15, 1
  889.       LINE (0, 0)-(639, 18 * Yfactr), 14, BF
  890.       LOCATE 1, 20: PRINT " MAPFIX.bas HELP SCREEN Ver "; Ver$
  891.       LOCATE 3, 1
  892.       
  893.       PRINT " The ORIGIN, CENTER and BORDER are shown (but only the CENTER and RANGE in "
  894.       PRINT " MAPLIST.apr are actually used by APRS.  Labels are right justified to the point"
  895.       PRINT " just after the last letter.  CALLS & OBJECT names will be left justified."
  896.       PRINT ""
  897.       PRINT " OPERATIONS          MAP FUNCTIONS         @N - NEW FEATURE   LABEL COMMANDS"
  898.       PRINT " H - HELP SCREENS    @C- Change CENTER     @A - ADD point      S - SHOW labels"
  899.       PRINT " D - map DIRECTORY   ^C- Change COLOR      @D - DELETE point  @L - add a LABEL"
  900.       PRINT "^S - SAVE MAP!!!      M- MAPLIST.apr file  @K - Kill feature   L - LABELS off"
  901.       PRINT " R - RESET pointers   O- OTHER map bordrs  @M - MOVE point"
  902.       PRINT " Q - QUIT            @R- set map RANGE     @T - TRIM borders  F8 - Add marker"
  903.       PRINT "                     @I- Import fm other map                 "
  904.       PRINT ""
  905.       PRINT " DISPLAY COMMANDS     POINTER MOVEMENTS   USGS CD ROM CMDS  DIGITIZER & GPS "
  906.       PRINT " SPACE to draw map    N- Next Feature     B- BOX PPD area   @O- OPEN COMMS"
  907.       PRINT " ARROWS  (shft)       P- Prev Feature     U- USGS overlay   @B- BEGIN new line"
  908.       PRINT " PgUP/DN (ctrl)       G- Go to Pointer    T- Test smoother  F1- MOVE cursor"
  909.       PRINT " HOME to Cursor       F- Find point      @S- SMOOTH file        vice ADD pt"
  910.       PRINT " END to map center   ^F- Find another    @U- USGS BUILD! "
  911.       PRINT "                     +/- move Pointer    @J- JOIN lines     @G- GPS OVERLAY"
  912.       PRINT " F2 CONVERT ORIGIN                       ^R- REDRAW on/off  F9- Init Mouse"
  913.       PRINT : LINE (0, 190 * Yfactr)-(639, 190 * Yfactr), 15
  914.               
  915.       IF Display$ <> "HELP" THEN
  916.        LOCATE BLn, 1
  917.        PRINT " HIT H AGAIN FOR MORE HELP SCREENS, OR SPACE BAR FOR MAP...";
  918.       END IF
  919.       Display$ = "HELP"
  920.       LINE (0, 0)-(634, 348 * Yfactr), 15, B
  921.       RETURN
  922.  
  923. LdMapLst: GOSUB BoxLine23: INPUT "FileSpec for MAPLIST.apr if not \APRS\MAPLIST.APR"; a$
  924.     IF a$ <> "" THEN F$ = a$ ELSE F$ = "\aprs\Maplist.apr"
  925.     OPEN F$ FOR INPUT AS #3: IF Fault <> 0 THEN RETURN
  926.     i = 1: NumGood = 0
  927.     INPUT #3, DfltY: LINE INPUT #3, a$
  928.     INPUT #3, DfltX: LINE INPUT #3, a$
  929.     INPUT #3, BestRng: LINE INPUT #3, a$: DfltR = BestRng
  930.     INPUT #3, GMToffset: LINE INPUT #3, a$
  931.     WHILE a$ <> "* BEGIN *": LINE INPUT #3, a$: WEND ' Skip comment block
  932.        REM RS = BestRng: REM center display
  933.        REM RS = 2 ^ INT(LOG(RS) / LOG(2))'Rng is intgr power of 2
  934.        REM CPX = CDX: CPY = CDY 'Cursor Posn to Center of Display
  935.     WHILE NOT EOF(3) AND i <= UBOUND(MapName$)
  936.        INPUT #3, MapName$(i), LatCen(i), LonCen(i), MapMax(i)
  937.        LINE INPUT #3, Comment$(i)' IGNORE ALL comment fields
  938.        REM now ignore maps that start with a *
  939.        IF LEFT$(MapName$(i), 1) <> "*" THEN NumGood = NumGood + 1
  940.        NumMaps = i: i = i + 1
  941.     WEND: CLOSE #3
  942.     IF NumGood >= MaxNumMAPS - 1 THEN
  943.        CLS : LOCATE 2, 5
  944.        PRINT "WARNING: Too many ACTIVE MAPS (more than"; MaxNumMAPS; ") in MAPLIST.map file for APRS"
  945.        LOCATE 4, 10: PRINT "Use EDITOR to suppress mapnames with an (*) that you don't need."
  946.        PRINT : PRINT : PRINT : MapListLoaded = -1
  947.        INPUT "HIT RETURN to continue"; a$
  948.     END IF
  949.     RETURN
  950.  
  951. ListMAPlist: IF NOT MapListLoaded THEN GOSUB LdMapLst
  952.    GOSUB ListHeader
  953.    FOR i = 1 TO NumMaps
  954.        IF i / 19 = INT(i / 19) THEN
  955.           LOCATE BLn, 1: PRINT "HIT RETURN to continue"; : INPUT a$
  956.           GOSUB ListHeader
  957.        END IF
  958.        PRINT MapName$(i); TAB(14);
  959.        PRINT INT(LatCen(i) * 100) / 100; TAB(21); INT(LonCen(i) * 100) / 100;
  960.        PRINT TAB(29); MapMax(i); TAB(36); LEFT$(LTRIM$(Comment$(i)), 43)
  961.    NEXT i
  962.    
  963.    LOCATE BLn, 1: PRINT "LIST COMPLETE. CONTINUE WITH NEXT MAPFIX COMMAND...";
  964.    RETURN
  965.  
  966. ListHeader: CLS
  967.    PRINT "MAPS in MAPLIST.map (*MAPS are suppressed)     [For now, use EDITOR to modify]"
  968.    PRINT :
  969.    PRINT "MAP NAME      LATcen LONcen  RANGE COmments"
  970.    PRINT "------------  ------ ------- ----- -------------------------------------------"
  971.    RETURN
  972.  
  973. DrwAndShow: IF NOT MapListLoaded THEN GOSUB LdMapLst
  974.             Display$ = "SHOW": GOSUB DrwMPaCur
  975.  
  976. ShowMaps: IF MapSize > RS / 2 THEN MapSize = RS / 2
  977.     LOCATE BLn, 1: PRINT " Drawing all maps >"; MapSize;
  978.     PRINT "mi.  F3 to see smaller, F4 for bigger, SPACE to cancel.";
  979.     LINE (0, 336 * Yfactr)-(639, 349 * Yfactr), 14, B
  980.     FOR i = 1 TO NumMaps
  981.    
  982.     x = 320 + Sfac * (CDX - LonCen(i)) * Hfac
  983.     y = Ycen + Sfac * (CDY - LatCen(i)) * Yfactr
  984.       dy = MapMax(i) * Sfac * Yfactr / 60
  985.       dx = dy * 640 / (400 * Yfactr) * Lfac
  986.       c = 15
  987.       IF MapMax(i) > 32 THEN c = 14
  988.       IF MapMax(i) > 64 THEN c = 12
  989.       IF MapMax(i) > 128 THEN c = 11
  990.       IF MapMax(i) > 256 THEN c = 13
  991.           
  992.     IF MapMax(i) > MapSize THEN
  993.        LINE (x - dx, y - dy)-(x + dx, y + dy), c, B
  994.        IF y + dy > Cfactr * Yfactr AND y + dy < BLn * Cfactr * Yfactr THEN
  995.           IF x + dx > 8 * (LEN(MapName$(i)) + 1) AND x + dx < 632 THEN
  996.              LOCATE (y + dy) / (Cfactr * Yfactr), (x + dx) / 8 - LEN(MapName$(i))
  997.              IF MapMax(i) > RS / 4 THEN PRINT MapName$(i);
  998.           END IF
  999.        END IF
  1000.     END IF
  1001.     NEXT i: RETURN
  1002.         
  1003. REM Next routines added by W7KKE for overlyaying GPS track histoiries
  1004.  
  1005. Hstdir: CLS : PRINT "HISTORY FILES DIRECTORY": PRINT
  1006.     PRINT "To display HST files, please enter the path to your xxxxxxx.HST files."
  1007.     PRINT "For example, the default '\APRS\*.HST' will show all maps in the APRS"
  1008.     PRINT "directory.  Similarly '*.hst' will search your present QBasic directory."
  1009.     PRINT "For any other path, enter the full file specification.": PRINT
  1010.          
  1011.     PRINT "Enter Filespec for searching the DIRECTORY (\aprs\*.hst)";
  1012.     INPUT F$: IF F$ = "" THEN F$ = "\aprs\*.hst"
  1013.     IF INSTR(F$, ".") = 0 THEN F$ = F$ + ".HST"
  1014.     PRINT : PRINT : FILES F$
  1015.     RETURN
  1016.  
  1017. LoadHst: GOSUB BoxLine23
  1018.     INPUT "Which history file to load (ENTER for list, Q to quit)"; F$
  1019.     IF UCASE$(F$) = "Q" THEN RETURN
  1020.     IF F$ = "" THEN GOSUB Hstdir: GOTO LoadHst
  1021.     a = INSTR(3, F$, "."): IF a = 0 THEN F$ = F$ + ".hst"
  1022.     Fault = 0: F$ = UCASE$(F$): OPEN F$ FOR INPUT AS #3
  1023.    
  1024.     IF Fault = 53 OR Fault = 62 THEN Fault = 0: RETURN
  1025.     GOSUB BoxLine23: PRINT "Loading track history from "; F$
  1026.       
  1027.     DO WHILE NOT EOF(3)
  1028.        i = i + 1
  1029.        INPUT #3, a$
  1030.        HLAT(i) = VAL(MID$(a$, 26, 2)) + (VAL(MID$(a$, 28, 5)) / 60)
  1031.        HLONG(i) = VAL(MID$(a$, 35, 3)) + (VAL(MID$(a$, 38, 5)) / 60)
  1032.        maxhist = i
  1033.      LOOP
  1034.      CLOSE #3: Histloaded = -1
  1035.      GOSUB BoxLine23: PRINT "File loading is complete.  GPS data is plotted."
  1036.      REM fall through...
  1037.  
  1038. DrawHist:  'put history track on map
  1039.      IF Histloaded THEN
  1040.         size = 3: IF RS < 2 THEN size = size * 2 / RS
  1041.         FOR i = 1 TO maxhist
  1042.             HMX = 320 + KP * (CDX - HLONG(i)) * ppdv * Hfac'new
  1043.             HMY = Ycen + KP * (CDY - HLAT(i)) * ppdv * Yfactr
  1044.             CIRCLE (HMX, HMY), size, 13
  1045.         NEXT i
  1046.      END IF
  1047.      RETURN
  1048.  
  1049. NewMap: CLS : PRINT "BEGINNING A NEW MAP FROM SCRATCH...": PRINT
  1050.    PRINT "All points in an APRS map are measured as an"
  1051.    PRINT "offset to the right and down from an origin."
  1052.    PRINT
  1053.    INPUT "Enter the LATITUDE  of the ORIGIN in degrees , minutes (DD, mm.xx)"; LATo, LAm
  1054.    INPUT "Enter the LONGITUDE of the ORIGIN in degrees , minutes (DDD, mm.xx)"; LONo, LOm
  1055.    LATo = LATo + LAm / 60
  1056.    LONo = LONo + LOm / 60
  1057.    PRINT
  1058.    PRINT "Choose the number of pixels per degree to set the map scale:"
  1059.    PRINT
  1060.    PRINT "Approximate size    Range from center  Pixels/Deg"
  1061.    PRINT "----------------    -----------------  ----------"
  1062.    PRINT "Big state or region        250             120"
  1063.    PRINT "Typical state              100             300"
  1064.    PRINT "Several Counties            50             600"
  1065.    PRINT "Typical VHF range           25            1200"
  1066.    PRINT "City streets (7.5 min maps) 12            2400"
  1067.    PRINT
  1068.    INPUT "Enter desired Pixels/Deg"; ppdB
  1069.    IF ppdB = 0 THEN GOTO NewMap
  1070.    REM In following lines, 500 is half of 999 (maximum nominal value for pts)
  1071.    LatCen = LATo - (500 * Yfactr / ppdB)
  1072.    LonCen = LONo - (500 / ppdB)
  1073.    GOSUB StartMap: ppdv = ppdB
  1074.    CLS : PRINT "YOU ARE NOW READY TO DRAW A NEW MAP...": PRINT : PRINT
  1075.    PRINT "A white border has been drawn around the maximum size permitted for this map"
  1076.    PRINT
  1077.    PRINT "USING CURSOR WITHOUT DIGITIZER:  Move coursor to starting point for a NEW"
  1078.    PRINT "feature and hit ALT-N.  Then enter new feature name (for reference purposes)"
  1079.    PRINT "and continue moving cursor to the next point and hit ALT-A to add more points."
  1080.    PRINT "Continue in this fashion, using ALT-N whenever you want to begin a NEW feature."
  1081.    PRINT
  1082.    PRINT "USING A DIGITIZER:  First, use ALT-O once to OPEN the digitizer COM port.  Then"
  1083.    PRINT "use ALT-B to BEGIN each new map feature.  Enter the name and color of the new"
  1084.    PRINT "feature.  Then use the digitizer mouse to add more points."
  1085.    PRINT : PRINT : PRINT
  1086.    PRINT "Add LABELS on the map at the current cursor location by using the ALT-L key. "
  1087.    PRINT
  1088.    PRINT "When you are finished, be sure to SAVE the map using the CTRL-S command..."
  1089.    PRINT : PRINT : PRINT
  1090.    PRINT "FOR HELP, REMEMBER THE  H  KEY!"
  1091.    PRINT : PRINT : PRINT "Hit ENTER to proceed..."; : INPUT a$
  1092.    RETURN
  1093.  
  1094. StartMap: REM This called by NEW and in middle of USGS build
  1095.    LatCen$ = "LAT of CENTER": LonCen$ = "LON of CENTER"
  1096.    MapRng = 60 * 500 * Yfactr / ppdB: REM 500 is half of full map size
  1097.    MapRng$ = "Map range from center"
  1098.    VS$ = "Pixels per degree"
  1099.    MinRng = 1: MR$ = "Reserved"
  1100.    TextLine$ = "NEW Map generated by MAPFIX.bas routine..."
  1101.    IF Key$ = "NEW" THEN RS = 2 ^ INT(LOG(MapRng) / LOG(2))'Rng is intgr of VERTrng
  1102.    CDX = LonCen: CDY = LatCen: CPX = CDX: CPY = CDY
  1103.    nmp = 1: nml = 0
  1104.    LNi = 1: LN$(1) = "Labels begin here"
  1105.    RETURN
  1106.  
  1107.  
  1108. DigiInit:
  1109.    CLS : PRINT : Digitizer = -1
  1110.    PRINT "DIGITIZER INITIALIZATION:"
  1111.    PRINT
  1112.    PRINT "This routine will replace many CURSOR functions with the Digitizer's MOUSE."
  1113.    PRINT "Assuming your digitizer can output an X,Y,C format."
  1114.    PRINT
  1115.    PRINT "Only Mercator projection charts will give absolutely accurate results.  Other"
  1116.    PRINT "types, Lambert Conformal, Conical, etc will induce distortions."
  1117.    PRINT
  1118.    PRINT "It has not been tested with East Longitude or South Latitude."
  1119.    PRINT : PRINT
  1120.    PRINT "The digitizr should operate at 9600,N,8,1 in POINT mode with 200 LPI resolution."
  1121.    PRINT "The FORMAT outputs X,Y,C values separated by commas (C is for button pressed."
  1122.    PRINT
  1123.    PRINT "Set up the digitizer according to your model's instructions.  For the model"
  1124.    PRINT "23360, use the drawing board menu by pressing the mouse button 0 on the SETUP"
  1125.    PRINT "label so that the LED is ON.  Then move the mouse to each other label and"
  1126.    PRINT "use the 0 button to toggle the value ON or off as follows:"
  1127.    PRINT
  1128.    PRINT "POINT is ON                             PARITY 7/8 and 1 are ON "
  1129.    PRINT "BAUDRATE 3 is ON                        FORMAT is ON ON off ON"
  1130.    PRINT "DATA RATE doesn't matter                RESOLUTION off off ON"
  1131.    PRINT : PRINT
  1132.    INPUT "Is DIGITIZER connected to COM1 or COM2 (1)"; a$
  1133.    IF a$ <> "2" THEN a$ = "COM1" ELSE a$ = "COM2"
  1134.    INPUT "9600 baud.  Is digitizer set for 7 or 8 bits (8)"; B$
  1135.    IF B$ = "7" THEN B$ = "E,7" ELSE B$ = "N,8"
  1136.    Port$ = a$ + ":9600," + B$ + ",1,cs0,ds0,cd0"
  1137.    OPEN Port$ FOR RANDOM AS #1
  1138.    
  1139.  
  1140.    CLS : PRINT "FIRST LETS TEST THE DIGITIZER, AND GET THE MAP ON STRAIGHT.": PRINT
  1141.    PRINT "Move your mouse (or pen) and hit the 0 button (or touch tablet) to see if the"
  1142.    PRINT "digitizer is outputting in the desired format.  While doing this, it is a good"
  1143.    PRINT "idea to verify that your map is on straight.  The Y values from the mouse"
  1144.    PRINT "should give the same values for the same LATITUDE line on both the right and"
  1145.    PRINT "left edges of the map.  If not, move your map to get it horizontal."
  1146.    PRINT
  1147.    PRINT "OUTPUT FORMAT:"
  1148.    PRINT
  1149.    PRINT "XXXXX,YYYYY,APn (Only the X and Y values are used (4 or 5 digits is ok)"
  1150.    PRINT "                (APn can be anything.  But if you press the 4th key on a 4"
  1151.    PRINT "                (button mouse, this will be a 3 and will only move cursor,"
  1152.    PRINT "                (and NOT add a point."
  1153.    PRINT
  1154.    LOCATE BLn, 1: PRINT "Hit ENTER and press 0 button on mouse to continue...";
  1155.    LOCATE 13, 1
  1156.    DO UNTIL INKEY$ <> "": LINE INPUT #1, a$: PRINT a$: LOOP
  1157.   
  1158.    CLS : PRINT
  1159.    PRINT "NEXT YOU MUST ESTABLISH THE SCALE OF YOUR DIGITIZER."
  1160.    PRINT
  1161.    PRINT "The scale is established by two points, the first near the"
  1162.    PRINT "upper left corner, the second near the lower right corner."
  1163.    PRINT
  1164.    PRINT "To get the best accuracy on maps not exactly MERCATOR, use points within the "
  1165.    PRINT "area where you are working, not on the extreme corners.  IE:  choose points"
  1166.    PRINT "that are in the center of the upper left quadrant and the lower right quadrant."
  1167.    PRINT
  1168.    PRINT "To establish the upper left reference point:"
  1169.    INPUT "     Enter lat  (deg,min)"; LATref1, M: LATref1 = LATref1 + M / 60
  1170.    INPUT "     Enter long (deg,min)"; LONref1, M: LONref1 = LONref1 + M / 60
  1171.    PRINT
  1172.  
  1173.    PRINT "Place the mouse on the upper left point and press the 0 button."
  1174.    LINE INPUT #1, a$: SOUND 150, 3
  1175.         digix1 = 5000 - VAL(LEFT$(a$, 5))
  1176.         digiy1 = VAL(MID$(a$, 7, 5))
  1177.         PRINT "Digitizer reads "; digix1, digiy1; " for this point.": PRINT
  1178.  
  1179.    PRINT "NOW Establish the lower right reference point:"
  1180.    INPUT "      Enter lat  (deg,min)"; LATref2, M: LATref2 = LATref2 + M / 60
  1181.    INPUT "      Enter long (deg,min)"; LONref2, M: LONref2 = LONref2 + M / 60
  1182.    PRINT
  1183.    PRINT "Place digitizer pen on lower right point."
  1184.    LINE INPUT #1, a$: SOUND 150, 3
  1185.         digix2 = 5000 - VAL(LEFT$(a$, 5))
  1186.         digiy2 = VAL(MID$(a$, 7, 5))
  1187.         PRINT "Digitizer reads "; digix2, digiy2; " for this point.": PRINT
  1188.  
  1189.    REM Find delta lat/long between reference points
  1190.    REM Calculate degrees per x/y unit
  1191.         degx# = (LONref1 - LONref2) / (digix1 - digix2)
  1192.         degy# = (LATref1 - LATref2) / (digiy1 - digiy2)
  1193.  
  1194.    CLS : PRINT "YOU ARE NOW READY TO USE THE DIGITIZER TO ENTER POINTS INTO MAPFIX..."
  1195.    PRINT
  1196.    PRINT "The digitizer works just about like the cursor and arrow keys in MAPFIX.  Any"
  1197.    PRINT "point identified by the digitizer will be ADDED just as if you had hit ALT-A."
  1198.    PRINT "All points are added to a feature after the current MapPoint identified by the"
  1199.    PRINT "white circle. "
  1200.    PRINT
  1201.    PRINT "With the digitizer, do NOT use the ALT-N NEW command which always begins at the"
  1202.    PRINT "current cursor location.  For the digitizer, use ALT-B to BEGIN a new feature."
  1203.    PRINT "You will be asked to identify the name and color of the new feature.  From then"
  1204.    PRINT "on, just move the digitizer mouse (or pen) to ADD new points.  "
  1205.    PRINT
  1206.    PRINT "If your digitizer mouse has 4 buttons, use the first (left) button for ADDing "
  1207.    PRINT "points, use the 4th (right) button to just move the cursor with no action."
  1208.    PRINT "With point-pens or single button mice, press F1 and the next use of the Pen "
  1209.    PRINT "will just move the cursor, NOT add a point."
  1210.    PRINT : PRINT
  1211.    INPUT "Hit ENTER to continue with MAPFIX..."; a$
  1212.    RETURN
  1213.  
  1214. GetXY: LINE INPUT #1, a$: SOUND 150, 3
  1215.    a = INSTR(a$, ","): IF a = 0 THEN RETURN
  1216.        x = 5000 - VAL(LEFT$(a$, a - 1))
  1217.    B = INSTR(a + 1, a$, ","): IF B = 0 THEN B = LEN(a$)
  1218.        y = VAL(MID$(a$, a + 1, B - (a)))
  1219.    Btn = VAL(RIGHT$(a$, 1))
  1220.    CPY = ((y - digiy2) * degy#) + LATref2
  1221.    CPX = ((x - digix2) * degx#) + LONref2
  1222.    IF LOC(1) <> 0 THEN a$ = INPUT$(LOC(1), #1)'Clear input buffer
  1223.    RETURN
  1224.  
  1225. BoxPPD:  GOSUB BoxLine23: INPUT "Enter the desired PPD"; a$
  1226.          IF a$ <> "" THEN ppdB = VAL(a$): gotthem = 0' To force re-evaluation
  1227. ShowBox: IF ppdB > 1 THEN
  1228.             y = (36000 / ppdB) * Sfac * Yfactr / 60 'had been 30000
  1229.             x = y * 560 / (400 * Yfactr) * Lfac 'had been 640
  1230.             GOSUB BoxLine23: LINE (CUX - x, CUY - y)-(CUX + x, CUY + y), 13, B
  1231.             PRINT "The box represents the largest APRS map that can be made with that scale."
  1232.          END IF
  1233.          RETURN
  1234.         
  1235. GetUSGS: REM This used for both U=OVERLAY and by ALT-U = USGS BUILD!
  1236.    ReDraw = 0: USGS = -1: ni = 0: nt = 0: j = 0: NumLines = 0
  1237.    IF Key$ <> "U" THEN
  1238.       IF ppdB = 0 THEN GOSUB BoxPPD
  1239.       ppdv = ppdB
  1240.       IF gotthem = 0 THEN
  1241.          LATo = CDY + (500 * Yfactr / ppdv)
  1242.          LONo = CDX + (500 / ppdv)
  1243.          LE = 1: OE = 1
  1244.          gotthem = 1
  1245.       END IF
  1246.       GOSUB BoxLine23: PRINT "Improve LAT ORIGIN of "; LATo; : INPUT a$
  1247.             IF a$ <> "" THEN LATo = VAL(a$)
  1248.       GOSUB BoxLine23: PRINT "Improve LON ORIGIN of "; LONo; : INPUT a$
  1249.             IF a$ <> "" THEN LONo = VAL(a$)
  1250.       GOSUB BoxLine23: INPUT "LATitude extent (100%)"; a$
  1251.             IF a$ <> "" THEN LE = VAL(a$) / 100
  1252.       GOSUB BoxLine23: INPUT "LONgitude extent (100%)"; a$
  1253.             IF a$ <> "" THEN OE = VAL(a$) / 100
  1254.       dx = ppdv * (LONo - CDX)
  1255.       dy = ppdv * (LATo - CDY)
  1256.       KP = 100 * 100 / (RS * ppdv)
  1257.       LatCen = CDY: LonCen = CDX: GOSUB StartMap
  1258.       LATtext$ = "Decimal LAT  of map ORIGIN"
  1259.       LONtext$ = "Decimal LONG of map ORIGIN"
  1260.       TextLine$ = "Map generated by MAPFIX from USGS 2,000,000:1 CD ROM (data valid mid-1980's)"
  1261.    END IF
  1262.    Slope = 1.2: REM IF ppdV < 600 THEN Slope = 1.5 ELSE Slope = 1.2
  1263.    SlopeI = 1 / Slope
  1264.    IF ppdv < 610 THEN mindel = .004 ELSE mindel = 2.4 / ppdv
  1265.    REM this .004 seems to be magic for 2,000,000 source data
  1266.  
  1267.    Lmax = 500 + 600 * LE: Lmin = 500 - 600 * LE 'Max=1100 and Min =-100
  1268.    Omax = 500 + 600 * OE: Omin = 500 - 600 * OE
  1269.    GOSUB BoxLine23: PRINT "Which category (AB,CF,PB,RD,RR,ST,WB) ("; Cat$; ")";
  1270.    INPUT a$
  1271.    IF a$ <> "" THEN
  1272.       a = INSTR(a$, "."): IF a = 0 THEN a$ = a$ + ".GRF"
  1273.       Cat$ = a$
  1274.    END IF
  1275.    GOSUB BoxLine23: PRINT "Enter path and S??_ to USGS file if not "; Path$;
  1276.    INPUT a$
  1277.    IF a$ <> "" THEN Path$ = a$
  1278.   
  1279.    USGS$ = Path$ + Cat$
  1280.    TY$ = UCASE$(LEFT$(Cat$, 2))
  1281.    LowMax = 99: HiMin = 0
  1282.    SELECT CASE TY$
  1283.       CASE "RD", "PB", "AB", "CF", "RR": MaxRnk = 99: MinRNk = 0
  1284.       CASE "WB": MaxRnk = 20: MinRNk = 0: LowMax = 0: HiMin = 5
  1285.       CASE "ST": MaxRnk = 50: MinRNk = 5: LowMax = 16: HiMin = 43
  1286.                ' Does not include canals
  1287.                ' Make minRNK=7 normal, 10 Alaska, 3 alaska for full map
  1288.    END SELECT
  1289.    OPEN USGS$ FOR INPUT AS #3
  1290.    IF Fault <> 0 THEN RETURN
  1291.    REM PRINT "raw data format.....", "   LineID", "#-Rnk-Atbts", "  NumPts"
  1292.    LOCATE 5, 72: PRINT "RNG"; INT(30000 / ppdv): LOCATE BLn - 1, 1
  1293.    IF Key$ = "U" THEN
  1294.       PRINT "While USGS OVERLAYED, do not redraw map or you will have to do it again...";
  1295.    ELSE PRINT "Blue circles start lines, Green Box ends.  Red points discarded, Yellow Kept!";
  1296.    END IF
  1297.    LOCATE 1, 71: PRINT "PTS     ";
  1298.    LOCATE 2, 71: PRINT "USED    ";
  1299.    LOCATE 3, 71: PRINT "LINE    ";
  1300.    LOCATE 4, 71: PRINT "USED    ";
  1301.    LOCATE 6, 72: PRINT "RNK";
  1302.  
  1303.  DO UNTIL EOF(3) OR LNi = MaxNumLines - 1
  1304.    IF INKEY$ <> "" THEN EXIT DO
  1305.    NumLines = NumLines + 1
  1306.    LOCATE 1, 75: PRINT nt
  1307.    LOCATE 2, 75: PRINT ni
  1308.    LOCATE 3, 75: PRINT NumLines
  1309.    LOCATE 4, 75: PRINT LNi
  1310.    a$ = INPUT$(20, 3): REM PRINT a$;
  1311.         LnID$ = LEFT$(a$, 7)
  1312.         Rank$ = MID$(a$, 8, 2): Rank = VAL(Rank$): LOCATE 6, 75: PRINT Rank
  1313.         Npts$ = MID$(a$, 10, 6): Npts = VAL(Npts$)
  1314.         AtCd$ = MID$(a$, 16, 5)
  1315.         a$ = LTRIM$(LnID$) + "-" + Rank$ + "-" + AtCd$
  1316.         REM PRINT , LnID$, a$, Npts$
  1317.    IF Rank < 24 THEN SavClr = 4 ELSE SavClr = 7
  1318.    IF Rank < 20 THEN SavClr = 12
  1319.    IF Rank < 14 THEN SavClr = 10
  1320.    IF TY$ = "WB" THEN SavClr = 11
  1321.    IF TY$ = "ST" THEN SavClr = 3
  1322.    IF TY$ = "CF" THEN SavClr = 14
  1323.    LineOK = 0: IF Key$ <> "U" THEN GOSUB BeginF
  1324.    REM IF ppdV < 610 THEN mindel = .004 ELSE mindel = 2.4 / ppdV
  1325.    REM this .004 seems to be magic for 2,000,000 source data
  1326.    FOR i = 1 TO Npts
  1327.     a$ = INPUT$(20, 3)
  1328.     IF Rank > MaxRnk OR Rank < MinRNk THEN IF Rank > 2 OR TY$ <> "ST" THEN GOTO Skp
  1329.     IF Rank > LowMax AND Rank < HiMin THEN GOTO Skp
  1330.     REM IF VAL(Rank$) > 99 THEN GOTO Skp
  1331.     LA = VAL(LEFT$(a$, 2)) + VAL(MID$(a$, 3, 2)) / 60 + VAL(MID$(a$, 5, 2)) / 3600
  1332.     LO = VAL(MID$(a$, 8, 3)) + VAL(MID$(a$, 11, 2)) / 60 + VAL(MID$(a$, 13, 2)) / 3600
  1333.     IF Key$ = "U" THEN
  1334.         REM Following lines used to limit points if just doing an OVERLAY only
  1335.         IF LA > CDY + RS / 60 OR LA < CDY - RS / 50 THEN GOTO Skp 'off screen
  1336.         IF LO > CDX + RS / (35 * Hfac) OR LO < CDX - RS / (35 * Hfac) THEN GOTO Skp
  1337.         REM s$ = MID$(a$, 16, 5)
  1338.         REM PRINT S$, LA, LO
  1339.     END IF 'oops stack problem here if too many times...
  1340.     y% = (LATo - LA) * ppdv
  1341.     x% = (LONo - LO) * ppdv: IF x% = 0 THEN x% = -1
  1342.     IF Key$ <> "U" AND (x% > Omax OR x% < Omin) THEN GOTO Skp'this ignores points off PPD
  1343.     IF Key$ <> "U" AND (y% > Lmax OR y% < Lmin) THEN GOTO Skp'scale
  1344.     LineOK = -1
  1345.        x1 = 320 + KP * (x% - dx) * Hfac
  1346.        y1 = Ycen + KP * (y% - dy) * Yfactr
  1347.        IF i > 2 THEN
  1348.           REM LINE (x, y)-(X1, Y1), 6
  1349.           dd = LO - LOb: IF dd = 0 THEN dd = .0000001
  1350.           dn = LA - LAb
  1351.           s = dn / dd' Note that 1>s>.01 for Xdelta of 1 to 100
  1352.           IF ABS(s) < .1 AND ABS(Lsp) < .1 THEN
  1353.              sd = 1
  1354.           ELSEIF ABS(s) > 10 AND ABS(Lsp) > 10 THEN sd = 1
  1355.           ELSEIF ABS(dd) < mindel AND ABS(dn) < mindel THEN sd = 1
  1356.           REM this had been .004 for 2,000,000 CD rom and ppdV 300 to 600
  1357.           REM now is 2.4/ppdV for 100,000
  1358.           ELSEIF s <> 0 THEN sd = Lsp / s
  1359.           ELSE sd = 0
  1360.           END IF
  1361.           IF sd > Slope OR sd < SlopeI OR i = Npts THEN
  1362.              PSET (x, y), 14
  1363.              IF Key$ <> "U" THEN GOSUB KeepLine
  1364.           ELSE PSET (x, y), 4
  1365.           END IF
  1366.           Lsp = s: nt = nt + 1
  1367.        ELSE Lsp = 0: CIRCLE (x1, y1), 2, 9
  1368.           IF Key$ <> "U" THEN GOSUB KeepLine 'keeps first two lines
  1369.        END IF
  1370.        LAb = LA: LOb = LO
  1371.        x = x1: y = y1
  1372.        
  1373. Skp: NEXT i
  1374.      IF Key$ <> "U" THEN
  1375.         IF LineOK THEN nmp = nmp - 1: z = z - 1: ni = ni + 1 ELSE GOSUB CanclF
  1376.      END IF
  1377.      LINE (x - 1, y - 1)-(x + 1, y + 1), 10, B ' Last Point
  1378.  LOOP
  1379.  IF LNi > MaxNumLines - 2 THEN LOCATE 12, 20: PRINT "PROCESSING STOPPED... TOO MANY LLINES!..."
  1380.    CLOSE #3
  1381.    IF x%(nmp) <> 0 THEN x%(nmp) = 0: y%(nmp) = 0
  1382.    GOSUB MakeNoise
  1383.    RETURN
  1384.  
  1385. KeepLine: x%(z) = x%: y%(z) = y%: nmp = nmp + 1: z = z + 1: ni = ni + 1: RETURN
  1386.  
  1387.  
  1388. Scrunch: i = 0: Pt = 0: nt = 0: ni = 0: GOSUB BoxLine23
  1389.     INPUT "Enter slope filter ratio 1.1 to 1.5 (typically 1.2)"; a$
  1390.     IF a$ = "" THEN Slope = 1.2 ELSE Slope = VAL(a$)
  1391.     DO UNTIL i >= nmp - 1
  1392.       i = i + 1
  1393.       x1 = 320 + KP * (x%(i) - dx) * Hfac
  1394.       y1 = Ycen + KP * (y%(i) - dy) * Yfactr
  1395.       IF x%(i) <> 0 THEN
  1396.         Pt = Pt + 1
  1397.         IF Pt > 2 THEN
  1398.           LINE (x, y)-(x1, y1), 6
  1399.           dd = x - x1
  1400.           dn = y - y1
  1401.           IF dd = 0 AND dn = 0 THEN
  1402.             sd = Slope: s = Lsp  'Here the points are identical
  1403.             CIRCLE (x, y), 9, 13
  1404.           ELSE
  1405.             IF dd = 0 THEN dd = .01
  1406.             dst = ((dd * dd) + (dn * dn)) ^ .5
  1407.             s = dn / dd' Note that 1>s>.01 for Xdelta of 1 to 100
  1408.             IF s = 0 THEN s = .05
  1409.             IF ABS(s) < .2 THEN s = .2 * SGN(s)
  1410.             IF ABS(s) > 5 THEN s = 5 * SGN(s)
  1411.             IF ABS(s) <= .2 AND ABS(Lsp) <= .2 THEN
  1412.                sd = 1
  1413.             ELSEIF ABS(s) >= 5 AND ABS(Lsp) >= 5 THEN sd = 1
  1414.             ELSE sd = Lsp / s
  1415.             END IF
  1416.             IF ABS(dd) > 50 * KP OR ABS(dn) > 30 * KP THEN sd = 0
  1417.             REM IF ABS(dd) < 5 OR ABS(dn) < 4 THEN sd = 1
  1418.           END IF
  1419.           IF sd > Slope OR sd < 1 / Slope OR x%(i + 1) = 0 OR NumRej > 4 THEN
  1420.             ni = ni + 1: PSET (x, y), 14: NumRej = 0
  1421.           ELSE PSET (x, y), 4: NumRej = NumRej + 1
  1422.             IF Key$ <> "T" THEN
  1423.                i = i - 1: nmp = nmp - 1
  1424.                FOR ii = i TO nmp
  1425.                    x%(ii) = x%(ii + 1): y%(ii) = y%(ii + 1)
  1426.                NEXT ii
  1427.             END IF
  1428.           END IF
  1429.           Lsp = s: nt = nt + 1
  1430.         ELSE Lsp = 0: nt = nt + 1: ni = ni + 1: CIRCLE (x1, y1), 4, 9
  1431.         END IF
  1432.       ELSE Pt = 0: nt = nt + 1: ni = ni + 1
  1433.         LOCATE 1, 71: PRINT "PTS "; nt
  1434.         LOCATE 2, 71: PRINT "SAVD"; ni
  1435.       END IF
  1436.       x = x1: y = y1
  1437.     LOOP
  1438.     GOTO MakeNoise
  1439.  
  1440. Join: REM Search for end=begin point values and CONCATONATE if equal!
  1441.    LnPtr = 0: i = 0: K = 0: GOSUB BoxLine23: PRINT "Lines joined: ";
  1442.    DO UNTIL i >= nmp
  1443.       i = i + 1
  1444.        IF x%(i) = x%(i + 2) AND y%(i) = y%(i + 2) AND y%(i + 1) = LColor THEN
  1445.           nmp = nmp - 2: LNi = LNi - 1: K = K + 1: LOCATE BLn - 2, 15: PRINT K
  1446.           FOR j = i + 1 TO nmp: x%(j) = x%(j + 2): y%(j) = y%(j + 2): NEXT j
  1447.           FOR j = LnPtr TO LNi: LN$(j) = LN$(j + 1): NEXT j
  1448.        ELSEIF x%(i) = 0 THEN LColor = y%(i): LnPtr = LnPtr + 1
  1449.        END IF
  1450.    LOOP: GOSUB DrawMap
  1451.    GOTO MakeNoise
  1452.  
  1453. MapCnvrt: CLS
  1454.    INPUT "Enter desired SCALE in pixels-per-deg"; PPDD
  1455.    INPUT "Enter New Latitude of origin"; NLat
  1456.    INPUT "Enter New Longitude of origin"; NLon
  1457.    REM now make offset and scale calculations
  1458.      Sfac = PPDD / ppdv
  1459.      LOfset = LONo - NLon
  1460.      LAfset = LATo - NLat
  1461.  
  1462.      PRINT : PRINT "Now processing map points."
  1463.  
  1464.      FOR i = 1 TO nmp'DO WHILE NOT EOF(3)
  1465.          IF x%(i) <> 0 THEN
  1466.             x%(i) = Sfac * (x%(i) - ppdv * LOfset)
  1467.             y%(i) = Sfac * (y%(i) - ppdv * LAfset)
  1468.             IF x%(i) = 0 THEN x%(i) = 1: PRINT "ZERO value of X!  Converted to 1,"; y%
  1469.         END IF
  1470.         REM print #4, MID$(STR$(x%), 2); ","; MID$(STR$(y%), 2)
  1471.         'IF x%(i) = 0 THEN do nothing
  1472.         IF y% = -1 THEN i = nmp
  1473.      NEXT i
  1474.      PRINT
  1475.      PRINT : PRINT "CONVERSION SUCCESSFUL."
  1476.      INPUT "Hit ENTER to continue.."; a$
  1477.      LATo = NLat
  1478.      LONo = NLon
  1479.      ppdv = PPDD
  1480.      Display$ = "MAP": ReDraw = -1: USGS = 0: GOSUB DrwMPaCur
  1481.      RETURN
  1482.  
  1483. IMPORT: LOCATE BLn - 1, 1: PRINT "IMPORT ALL FEATURES (of one color) FROM ANOTHER MAP THAT FIT INSIDE THIS MAP'S";
  1484.    LOCATE BLn, 1: PRINT "BORDER.  POINTS ARE AUTOMATICALLY CONVERTED TO THE CURRENT SCALE AND ORIGIN.  ";
  1485.    LOCATE BLn - 2, 1: PRINT "Enter filename of source map ("; IMPORT$; ")";
  1486.    INPUT a$
  1487.    IF a$ <> "" THEN IMPORT$ = a$
  1488.    Fault = 0: OPEN IMPORT$ FOR INPUT AS #1
  1489.    IF Fault <> 0 THEN RETURN
  1490.    LOCATE BLn - 3, 1
  1491.    INPUT "Enter color of feature to import (1 to 15) or ALL"; a$
  1492.    IF UCASE$(a$) = "ALL" THEN All = -1 ELSE All = 0
  1493.    IF a$ <> "" THEN Fcolr = VAL(a$)
  1494.    INPUT #1, LATa: LINE INPUT #1, a$:
  1495.    INPUT #1, LONa: LINE INPUT #1, a$: IF NLon = 0 THEN NLon = LONa
  1496.    INPUT #1, OppdV: LINE INPUT #1, a$'Pix-per-deg-Vert
  1497.    INPUT #1, oLatCen: LINE INPUT #1, a$
  1498.    INPUT #1, oLonCen: LINE INPUT #1, a$
  1499.    INPUT #1, oMapRng: LINE INPUT #1, a$
  1500.    INPUT #1, oMinRnga: LINE INPUT #1, a$
  1501.    LINE INPUT #1, a$: REM ignore line of instructions
  1502.    i = 0
  1503.    REM now make offset and scale calculations
  1504.    Nfac = ppdv / OppdV
  1505.    LOfset = LONa - LONo
  1506.    LAfset = LATa - LATo
  1507.     by = ppdv * MapRng / 60 ' These the same as TRIM borders
  1508.     bx = by / Lfac
  1509.     s = nmp'start for RE-DRAW at end of this routine
  1510.     x% = 1: y% = 1' To get around first test
  1511.     DO WHILE NOT EOF(1)
  1512.       IF x% = 0 AND y% = 0 THEN
  1513.          INPUT #1, y%: LINE INPUT #1, a$'get color and name
  1514.          IF y% = Fcolr OR All THEN
  1515.             x%(nmp) = 0: y%(nmp) = y% ' over top of previous 0,0 at nmp
  1516.             LNi = LNi + 1: LN$(LNi) = a$
  1517.             NofPts = 0' By keeping track of #of points, we can be sure not to
  1518.                     ' delete any points until line has at least 2 points in it
  1519.             DO
  1520.                INPUT #1, x%, y%
  1521.                nmp = nmp + 1
  1522.                IF x% = 0 THEN EXIT DO
  1523.                x%(nmp) = Nfac * (x% - OppdV * LOfset)
  1524.                y%(nmp) = Nfac * (y% - OppdV * LAfset)
  1525.                IF x%(nmp) > dx + bx OR y%(nmp) > dy + by THEN bad = 1 ELSE bad = 0
  1526.                IF x%(nmp) < dx - bx OR y%(nmp) < dy - by THEN bad = 1
  1527.                IF x%(nmp) = 0 THEN x%(nmp) = 1: PRINT "ZERO value of X!  Converted to 1,"; y%
  1528.                IF bad AND NofPts > 1 THEN nmp = nmp - 1 ELSE NofPts = NofPts + 1
  1529.             LOOP
  1530.             IF NofPts = 2 AND bad THEN LNi = LNi - 1: nmp = nmp - 3
  1531.             x%(nmp) = 0: y%(nmp) = 0
  1532.          END IF
  1533.       ELSE INPUT #1, x%, y%
  1534.       END IF
  1535.       IF x% = 0 AND y% = -1 THEN EXIT DO
  1536.    LOOP
  1537.    LOCATE BLn - 2, 1: PRINT "All map points converted....."
  1538.       DO WHILE NOT EOF(1)
  1539.       LINE INPUT #1, a$
  1540.       LOOP: CLOSE #1
  1541.       GOSUB DP
  1542.        
  1543. MakeNoise: SOUND 800, 4: SOUND 1500, 3: SOUND 500, 2: RETURN
  1544.  
  1545. END
  1546.  
  1547.